//
//  YsSmartPenBindVC.m
//  Pods-YsSmartPenModule_Example
//
//  Created by Cer on 2020/4/23.
//

#import "YsSmartPenBindVC.h"
#import "YsSmartPenHeaderBindView.h"
#import "YsSmartPenBindCell.h"
#import <YYKit/YYKit.h>
#import <YsToolsManager/YsToolsManager.h>
#import <ReactiveObjC/ReactiveObjC.h>
#import <Masonry/Masonry.h>

@interface YsSmartPenBindVC () <UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, strong) UIButton *buyBtn;
@end

@implementation YsSmartPenBindVC

- (void)initSubviews{
    [super initSubviews];
    
    [self didInitializeWithStyle:UITableViewStyleGrouped];
}

- (void)initTableView
{
    [super initTableView];
    YsSmartPenHeaderBindView *headerView = [[YsSmartPenHeaderBindView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 100)];
    self.tableView.tableHeaderView = headerView;
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}

- (void)setupNavigationItems{
    [super setupNavigationItems];
    UIButton *buyBtn = [UIButton buttonWithTitle:@"购买设备" fontSize:15 titleColor:[UIColor colorWithHexString:@"2B2F39"]];
    self.buyBtn = buyBtn;
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:buyBtn];
}

- (void)setupToolbarItems{
    [super setupToolbarItems];
}

- (void)initData{
    [super initData];
}

- (void)initClick{
    [super initClick];

    @weakify(self);
    [[self.buyBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
        @strongify(self);
        [NSString tool_showLableText:@"sfsfd"];
    }];
}

- (void)bind{
    [super bind];
}

#pragma mark - tableviewDelegate

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 64;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    YsSmartPenBindCell *cell = [tableView dequeueReusableCellWithIdentifier:YsSmartPenBindCell.className];
    if (!cell) {
        cell = [[YsSmartPenBindCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:YsSmartPenBindCell.className];
    }
    return cell;
}
@end
